#include "postman.h"
#include "ui_postman.h"

Postman::Postman(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Postman)
{
    ui->setupUi(this);
}

Postman::~Postman()
{
    delete ui;
}

void Postman::on_pushButton_clicked()
{
    if(func_findname(softwarename))
    {
        uninstall *dlg = new uninstall(this);
        dlg->show();
    }
    else
    {
        QMessageBox::information(NULL,"infor","no this software");
    }
}

void Postman::on_pushButton_3_clicked()
{
    Download *dlg3 = new Download(this);
    dlg3->show();
    dlg3->ui->editUrl->setText("https://dl.pstmn.io/download/latest/linux64");
    QSqlQuery query;
    QString addres = dlg3->ui->editPath->text();
    QDate date4 = QDate::currentDate();
    query.prepare("insert into user(SaveAddress,InstallationTime,SoftwareName) values (:SaveAddress,:InstallationTime,:SoftwareName)");
    query.bindValue(":SoftwareName","Postman");
    query.bindValue(":SaveAddress",addres);
    query.bindValue(":InstallationTime",date4);
    query.exec();
}
